Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keccak: error out if passed mdlen 100 #8428

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

moneromooo-monero
Copy link
Collaborator

If we were to call it with 100, it would cause rsiz to be 0,
leading to an infinite loop.
This is really a pedantic patch, but since there's already a
range test, might as well make it better.

If we were to call it with 100, it would cause rsiz to be 0,
leading to an infinite loop.
This is really a pedantic patch, but since there's already a
range test, might as well make it better.
@jeffro256
Copy link
Contributor

jeffro256 commented Jul 12, 2022

There's another check against mdlen a few lines below (line 162 I believe) that I think you should bring back up where this edit is: (size_t)mdlen % sizeof(uint64_t)) != 0. It also aborts when that condition is met, but for some reason it's only checked after memcpy and memset and a bunch of expensive operations. But besides that, I approve this change

@moneromooo-monero
Copy link
Collaborator Author

True, but "expensive" here is lightning fast compared to process termination. I'd rather keep the diff minimal, unless you find that moving that test forward fixes some possible bug.

@jeffro256
Copy link
Contributor

True, but "expensive" here is lightning fast compared to process termination. I'd rather keep the diff minimal, unless you find that moving that test forward fixes some possible bug.

Fair enough

@luigi1111 luigi1111 merged commit 53a8cf7 into monero-project:master Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants